/**
 * 
 */

$(function() {
	
	var url=location.href;
	if(url.indexOf("f=i")!=-1){
		parent.location.href="gauge/login.html";
	}
	$("#login_button").click(function() {
		$("#login_button_inner").click();
	});
})

function login() {
	var username = $("#username").val().trim();
	var password = $("#password").val().trim();
	var rememberme=$("#rememberme").is(":checked");
	$.post("login.do", {
		username : username,
		password : password,
		rememberme:rememberme
	}, function(data) {
		var result = JSON.parse(data);
		if (result.status == "success") {
			location.href = "index.html"
		} else {
			var warn = "<div id='login_info' class='alert alert-danger alert-dismissible' role='alert'>"
					+ "<button type='button' class='close' data-dismiss='alert' aria-label='Close'>" 
					+ "<span aria-hidden='true'>&times;</span></button>"
					+ "<strong>警告:</strong>" + result.info + "</div>"
			$("#login_info").remove();
			$("#warning").append(warn);
		}
	})
}


